var $ = getApp(), methods = require("../methods.js");
Page(Object.assign({}, methods, {
	data: {
		prodata: '',
		isload: 0
	},
	_onLoad: function (option) {
		var that = this;
		$.get('kanjia/orderdetail', { id: that.options.id }, function (res) {
			that.setData({
				detail: res.detail,
				shopset: res.shopset,
				storeinfo: res.storeinfo,
				isload: 1
			});
			$.loading(false);
		});

	},
	todel: function (e) {
		var that = this;
		var orderid = e.currentTarget.dataset.id
		$.confirm('确定要删除该订单吗?', function () {
			$.post('kanjia/delOrder', { orderid: orderid }, function (data) {
				$.success(data.msg);
				setTimeout(function () {
					that.onLoad();
				}, 1000)
			}, '删除中');
		})
	},
	toclose: function (e) {
		var that = this;
		var orderid = e.currentTarget.dataset.id
		$.confirm('确定要关闭该订单吗?', function () {
			$.post('kanjia/closeOrder', { orderid: orderid }, function (data) {
				$.success(data.msg);
				setTimeout(function () {
					that.onLoad();
				}, 1000)
			}, '提交中');
		})
	},
	orderCollect: function (e) {
		var that = this;
		var orderid = e.currentTarget.dataset.id
		$.confirm('确定要收货吗?', function () {
			$.post('kanjia/orderCollect', { orderid: orderid }, function (data) {
				$.success(data.msg);
				setTimeout(function () {
					that.onLoad();
				}, 1000)
			})
		}, '收货中');
	},
}))